﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ScormModel;
namespace WpfELearningAuthoringTool
{
    class SequenceProcessing
    {
        #region Linear Template
        public Sequencing buildCourseSequencingForLinearTemplate()
        {
            /*
              <imsss:sequencing>
            <imsss:controlMode choice="false" flow="true"/>
            <imsss:sequencingRules>
               <imsss:exitConditionRule>
                  <imsss:ruleConditions>
                     <imsss:ruleCondition condition="completed"/>
                  </imsss:ruleConditions>
                  <imsss:ruleAction action="exit"/>
               </imsss:exitConditionRule>
            </imsss:sequencingRules>
            <imsss:rollupRules >
               <imsss:rollupRule childActivitySet="all">
                  <imsss:rollupConditions>
                     <imsss:rollupCondition condition="satisfied"/>
                  </imsss:rollupConditions>
                  <imsss:rollupAction action="satisfied"/>
               </imsss:rollupRule>
               <imsss:rollupRule childActivitySet="any">
                  <imsss:rollupConditions>
                     <imsss:rollupCondition operator ="not" condition="satisfied"/>
                  </imsss:rollupConditions>
                  <imsss:rollupAction action="notSatisfied"/>
               </imsss:rollupRule>
            </imsss:rollupRules>
         </imsss:sequencing>
             */
            Sequencing courseSequencing = new Sequencing();
            ControlMode controlMode = new ControlMode();
            controlMode.Choice = "false";
            controlMode.Flow = "true";
            courseSequencing.ControlMode = controlMode;

            SequencingRules sequencingRules = new SequencingRules();
            sequencingRules.ListExitConditionRule = new List<ExitConditionRule>();
            ExitConditionRule exitConditionRule = new ExitConditionRule();
            exitConditionRule.RuleConditions = new RuleConditions();
            exitConditionRule.RuleConditions.ListRuleCondition = new List<RuleCondition>();
            RuleCondition ruleCondition = new RuleCondition();
            ruleCondition.Condition = "completed";
            exitConditionRule.RuleConditions.ListRuleCondition.Add(ruleCondition);
            exitConditionRule.RuleAction = new RuleAction();
            exitConditionRule.RuleAction.Action = "exit";
            sequencingRules.ListExitConditionRule.Add(exitConditionRule);
            courseSequencing.SequencingRules = sequencingRules;

            RollupRules rollupRules = new RollupRules();
            rollupRules.RollupObjectiveSatisfied = "false";
            rollupRules.ListRollupRule = new List<RollupRule>();

            RollupRule rollupRule = new RollupRule();
            rollupRule.ChildActivitySet = "all";
            rollupRule.RollupConditions = new RollupConditions();
            rollupRule.RollupConditions.ListRollupCondition = new List<RollupCondition>();
            RollupCondition rollupCondition = new RollupCondition();
            rollupCondition.Condition = "satisfied";
            rollupRule.RollupConditions.ListRollupCondition.Add(rollupCondition);
            rollupRule.RollupAction = new RollupAction();
            rollupRule.RollupAction.Action = "satisfied";

            RollupRule rollupRule1 = new RollupRule();
            rollupRule1.ChildActivitySet = "any";
            rollupRule1.RollupConditions = new RollupConditions();
            rollupRule1.RollupConditions.ListRollupCondition = new List<RollupCondition>();
            RollupCondition rollupCondition1 = new RollupCondition();
            rollupCondition1.Condition = "satisfied";
            rollupCondition1.Operator = "not";
            rollupRule1.RollupConditions.ListRollupCondition.Add(rollupCondition1);
            rollupRule1.RollupAction = new RollupAction();
            rollupRule1.RollupAction.Action = "satisfied";

            rollupRules.ListRollupRule.Add(rollupRule);
            rollupRules.ListRollupRule.Add(rollupRule1);
            courseSequencing.RollupRules = rollupRules;
            return courseSequencing;
        }
        public Sequencing buildIntroSequencingForLinearTemplate()
        {
            /*
              <item identifier="INTRO" identifierref="RESOURCE_INTRO">
            <title>Introduction</title>
            <imsss:sequencing>
               <imsss:rollupRules rollupObjectiveSatisfied="false"/>
            </imsss:sequencing>
             </item>
             */
            Sequencing introSequencing = new Sequencing();
            RollupRules rollupRules = new RollupRules();
            rollupRules.RollupObjectiveSatisfied = "false";
            introSequencing.RollupRules = rollupRules;
            return introSequencing;
        }
        public Sequencing buildModuleSequencingForLinearTemplate()
        {
            /*
                <imsss:sequencing>
               <imsss:controlMode choice="false" flow="true"/>
               <imsss:rollupRules rollupObjectiveSatisfied="false"/>
            </imsss:sequencing>
             */
            Sequencing moduleSequencing = new Sequencing();
            ControlMode controlMode = new ControlMode();
            controlMode.Choice = "false";
            controlMode.Flow = "true";
            moduleSequencing.ControlMode = controlMode;
            RollupRules rollupRules = new RollupRules();
            rollupRules.RollupObjectiveSatisfied = "false";
            moduleSequencing.RollupRules = rollupRules;
            return moduleSequencing;
        }
        public Sequencing buildExamSequencingForLinearTemplate()
        {
            /*
             <imsss:sequencing>
               <imsss:controlMode choice="false" flow="true"/>
               <imsss:rollupRules >
                  <imsss:rollupRule childActivitySet="all">
                     <imsss:rollupConditions>
                        <imsss:rollupCondition condition="attempted"/>
                     </imsss:rollupConditions>
                     <imsss:rollupAction action="completed"/>
                  </imsss:rollupRule>
               </imsss:rollupRules>
               <imsss:objectives>
                  <imsss:primaryObjective satisfiedByMeasure="true">
                     <imsss:minNormalizedMeasure>0.6</imsss:minNormalizedMeasure>
                  </imsss:primaryObjective>
               </imsss:objectives>
            </imsss:sequencing>
             */
            Sequencing examSequencing = new Sequencing();
            ControlMode controlMode = new ControlMode();
            controlMode.Choice = "false";
            controlMode.Flow = "true";
            examSequencing.ControlMode = controlMode;

            RollupRules rollupRules = new RollupRules();
            rollupRules.RollupObjectiveSatisfied = "false";
            rollupRules.ListRollupRule = new List<RollupRule>();
            RollupRule rollupRule = new RollupRule();
            rollupRule.ChildActivitySet = "all";
            rollupRule.RollupConditions = new RollupConditions();
            rollupRule.RollupConditions.ListRollupCondition = new List<RollupCondition>();
            RollupCondition rollupCondition = new RollupCondition();
            rollupCondition.Condition = "attempted";
            rollupRule.RollupConditions.ListRollupCondition.Add(rollupCondition);
            rollupRule.RollupAction = new RollupAction();
            rollupRule.RollupAction.Action = "completed";
            rollupRules.ListRollupRule.Add(rollupRule);
            examSequencing.RollupRules = rollupRules;

            Objectives objectives = new Objectives();
            PrimaryObjective primaryObjective = new PrimaryObjective();
            primaryObjective.SatisfiedByMeasure = "true";
            primaryObjective.MinNormalizedMeasure = "0.6";
            objectives.PrimaryObjective = primaryObjective;

            examSequencing.Objectives = objectives;

            return examSequencing;
        }
        #endregion
        #region Linear Choice Template
        public Sequencing buildCourseSequencingForLinearChoiceTemplate()
        {
            /*
                 <imsss:sequencing>
            <imsss:controlMode flow="true"/>
            <imsss:sequencingRules>
               <imsss:exitConditionRule>
                  <imsss:ruleConditions>
                     <imsss:ruleCondition condition="completed"/>
                  </imsss:ruleConditions>
                  <imsss:ruleAction action="exit"/>
               </imsss:exitConditionRule>
            </imsss:sequencingRules>
            <imsss:rollupRules >
               <imsss:rollupRule childActivitySet="any">
                  <imsss:rollupConditions>
                     <imsss:rollupCondition operator ="not" condition="satisfied"/>
                  </imsss:rollupConditions>
                  <imsss:rollupAction action="notSatisfied"/>
               </imsss:rollupRule>
            </imsss:rollupRules>
         </imsss:sequencing>
             */
            Sequencing courseSequencing = new Sequencing();
            ControlMode controlMode = new ControlMode();
            controlMode.Flow = "true";

            SequencingRules sequencingRules = new SequencingRules();
            sequencingRules.ListExitConditionRule = new List<ExitConditionRule>();
            ExitConditionRule exitConRule = new ExitConditionRule();
            RuleConditions exitRuleCons = new RuleConditions();
            RuleCondition exitRuleCon = new RuleCondition();
            exitRuleCon.Condition = "completed";
            exitRuleCons.ListRuleCondition = new List<RuleCondition>();
            exitRuleCons.ListRuleCondition.Add(exitRuleCon);
            exitConRule.RuleConditions = exitRuleCons;
            exitConRule.RuleAction = new RuleAction();
            exitConRule.RuleAction.Action = "exit";
            sequencingRules.ListExitConditionRule.Add(exitConRule);

            RollupRules rollupRules = new RollupRules();
            rollupRules.ListRollupRule = new List<RollupRule>();
            RollupRule rollupRule = new RollupRule();
            rollupRule.ChildActivitySet = "any";
            rollupRule.RollupConditions = new RollupConditions();
            rollupRule.RollupConditions.ListRollupCondition = new List<RollupCondition>();
            RollupCondition rollupCondition = new RollupCondition();
            rollupCondition.Condition = "attempted";
            rollupCondition.Operator = "not";
            rollupRule.RollupConditions.ListRollupCondition.Add(rollupCondition);
            rollupRule.RollupAction = new RollupAction();
            rollupRule.RollupAction.Action = "notSatisfied";
            rollupRules.ListRollupRule.Add(rollupRule);

            courseSequencing.ControlMode = controlMode;
            courseSequencing.SequencingRules = sequencingRules;
            courseSequencing.RollupRules = rollupRules;

            return courseSequencing;
        }
        public Sequencing buildModuleSequencingForLinearChoiceTemplate()
        {
            /*
             <imsss:sequencing>
                  <imsss:controlMode choice="false" choiceExit ="false" flow="true"/>
                  <imsss:sequencingRules>
                     <imsss:preConditionRule>
                        <imsss:ruleConditions>
                           <imsss:ruleCondition condition="completed"/>
                        </imsss:ruleConditions>
                        <imsss:ruleAction action="disabled"/>
                     </imsss:preConditionRule>
                     <imsss:exitConditionRule>
                        <imsss:ruleConditions>
                           <imsss:ruleCondition condition="completed"/>
                        </imsss:ruleConditions>
                        <imsss:ruleAction action="exit"/>
                     </imsss:exitConditionRule>
                  </imsss:sequencingRules>
               </imsss:sequencing>
             */
            Sequencing moduleSequencing = new Sequencing();

            ControlMode controlMode = new ControlMode();
            controlMode.Choice = "false";
            controlMode.ChoiceExit = "false";
            controlMode.Flow = "true";

            SequencingRules sequencingRules = new SequencingRules();
            sequencingRules.ListPreConditionRule = new List<PreConditionRule>();
            sequencingRules.ListExitConditionRule = new List<ExitConditionRule>();

            PreConditionRule preConRule = new PreConditionRule();
            RuleConditions preRuleCons = new RuleConditions();
            RuleCondition preRuleCon = new RuleCondition();
            preRuleCon.Condition = "completed";
            preRuleCons.ListRuleCondition = new List<RuleCondition>();
            preRuleCons.ListRuleCondition.Add(preRuleCon);
            preConRule.RuleConditions = preRuleCons;
            preConRule.RuleAction = new RuleAction();
            preConRule.RuleAction.Action = "disabled";
            sequencingRules.ListPreConditionRule.Add(preConRule);

            ExitConditionRule exitConRule = new ExitConditionRule();
            RuleConditions exitRuleCons = new RuleConditions();
            RuleCondition exitRuleCon = new RuleCondition();
            exitRuleCon.Condition = "completed";
            exitRuleCons.ListRuleCondition = new List<RuleCondition>();
            exitRuleCons.ListRuleCondition.Add(exitRuleCon);
            exitConRule.RuleConditions = exitRuleCons;
            exitConRule.RuleAction = new RuleAction();
            exitConRule.RuleAction.Action = "exit";

            sequencingRules.ListExitConditionRule.Add(exitConRule);

            moduleSequencing.ControlMode = controlMode;
            moduleSequencing.SequencingRules = sequencingRules;
            return moduleSequencing;
        }
        public Sequencing buildIntroSequencingForLinearChoiceTemplate()
        {
            /*
             <imsss:sequencing>
               <imsss:limitConditions attemptLimit = "1" />
               <imsss:rollupRules rollupObjectiveSatisfied="false"/>
            </imsss:sequencing>
             */
            Sequencing introSequencing = new Sequencing();
            LimitConditions limitConditions = new LimitConditions();
            limitConditions.AttemptLimit = "1";
            RollupRules rollupRules = new RollupRules();
            rollupRules.RollupObjectiveSatisfied = "false";

            introSequencing.LimitConditions = limitConditions;
            introSequencing.RollupRules = rollupRules;

            return introSequencing;
        }
        public Sequencing buildLessonSequencingForLinearChoiceTemplate()
        {
            /*
                <imsss:sequencing>
                     <imsss:deliveryControls tracked = "false"/>
                  </imsss:sequencing>
               </item>
             */
            Sequencing lessonSequencing = new Sequencing();
            DeliveryControls deliveryControls = new DeliveryControls();
            deliveryControls.Tracked = "false";
            lessonSequencing.DeliveryControls = deliveryControls;

            return lessonSequencing;
        }
        public Sequencing buildExamSequencingForLinearChoiceTemplate()
        {
            /*
             <imsss:sequencing>
                     <imsss:controlMode choice="false" choiceExit ="false" flow="true" forwardOnly="true"/>
                     <imsss:rollupRules >
                        <imsss:rollupRule childActivitySet="all">
                           <imsss:rollupConditions>
                              <imsss:rollupCondition condition="attempted"/>
                           </imsss:rollupConditions>
                           <imsss:rollupAction action="completed"/>
                        </imsss:rollupRule>
                     </imsss:rollupRules>
                     <imsss:objectives>
                        <imsss:primaryObjective satisfiedByMeasure="true">
                           <imsss:minNormalizedMeasure>0.6</imsss:minNormalizedMeasure>
                        </imsss:primaryObjective>
                     </imsss:objectives>
                  </imsss:sequencing>
             */
            Sequencing examSequencing = new Sequencing();
            ControlMode controlMode = new ControlMode();
            controlMode.Choice = "false";
            controlMode.ChoiceExit = "false";
            controlMode.Flow = "true";
            controlMode.ForwardOnly = "true";

            RollupRules rollupRules = new RollupRules();
            rollupRules.ListRollupRule = new List<RollupRule>();
            RollupRule rollupRule = new RollupRule();
            rollupRule.ChildActivitySet = "all";
            rollupRule.RollupConditions = new RollupConditions();
            rollupRule.RollupConditions.ListRollupCondition = new List<RollupCondition>();
            RollupCondition rollupCondition = new RollupCondition();
            rollupCondition.Condition = "attempted";
            rollupRule.RollupConditions.ListRollupCondition.Add(rollupCondition);
            rollupRule.RollupAction = new RollupAction();
            rollupRule.RollupAction.Action = "completed";
            rollupRules.ListRollupRule.Add(rollupRule);

            Objectives objectives = new Objectives();
            PrimaryObjective primaryObjective = new PrimaryObjective();
            primaryObjective.SatisfiedByMeasure = "true";
            primaryObjective.MinNormalizedMeasure = "0.6";
            objectives.PrimaryObjective = primaryObjective;

            examSequencing.ControlMode = controlMode;
            examSequencing.RollupRules = rollupRules;
            examSequencing.Objectives = objectives;

            return examSequencing;
        }
        #endregion
        #region Linear Control Template
        public Sequencing buildIntroSequencingForLinearControlTemplate()
        {
            /*
             <imsss:sequencing>
               <imsss:rollupRules rollupObjectiveSatisfied="false"/>
            </imsss:sequencing>
             */
            Sequencing introSequencing = new Sequencing();
            RollupRules rollupRules = new RollupRules();
            rollupRules.RollupObjectiveSatisfied = "false";
            introSequencing.RollupRules = rollupRules;

            return introSequencing;
        }
        public Sequencing buildModuleSequencingForLinearControlTemplate()
        {
            /*
             <imsss:sequencing>
               <imsss:controlMode choice="false" flow="true"/>
               <imsss:rollupRules rollupObjectiveSatisfied="false"/>
            </imsss:sequencing>
             */
            Sequencing moduleSequencing = new Sequencing();

            ControlMode controlMode = new ControlMode();
            controlMode.Choice = "false";
            controlMode.Flow = "true";
            moduleSequencing.ControlMode = controlMode;

            RollupRules rollupRules = new RollupRules();
            rollupRules.RollupObjectiveSatisfied = "false";
            moduleSequencing.RollupRules = rollupRules;

            return moduleSequencing;
        }
        public Presentation buildModulePresentationForLinearControlTemplate()
        {
            /*
                <adlnav:presentation>
               <adlnav:navigationInterface>
                  <adlnav:hideLMSUI>previous</adlnav:hideLMSUI>
                  <adlnav:hideLMSUI>continue</adlnav:hideLMSUI>
               </adlnav:navigationInterface>
            </adlnav:presentation>
             */
            Presentation presentation = new Presentation();
            NavigationInterface nv = new NavigationInterface();
            nv.ListHideLMSUI = new List<string>();
            nv.ListHideLMSUI.Add("previous");
            nv.ListHideLMSUI.Add("previous");
            presentation.NavigationInterface = nv;
            return presentation;
        }
        public Sequencing buildExamSequencingForLinearControlTemplate()
        {
            /*
                <imsss:sequencing>
               <imsss:controlMode choice="false" flow="true"/>
               <imsss:rollupRules >
                  <imsss:rollupRule childActivitySet="all">
                     <imsss:rollupConditions>
                        <imsss:rollupCondition condition="attempted"/>
                     </imsss:rollupConditions>
                     <imsss:rollupAction action="completed"/>
                  </imsss:rollupRule>
               </imsss:rollupRules>
               <imsss:objectives>
                  <imsss:primaryObjective satisfiedByMeasure="true">
                     <imsss:minNormalizedMeasure>0.6</imsss:minNormalizedMeasure>
                  </imsss:primaryObjective>
               </imsss:objectives>
            </imsss:sequencing>
             */
            Sequencing examSequencing = new Sequencing();
            ControlMode controlMode = new ControlMode();
            controlMode.Choice = "false";
            controlMode.Flow = "true";

            RollupRules rollupRules = new RollupRules();
            rollupRules.ListRollupRule = new List<RollupRule>();
            RollupRule rollupRule = new RollupRule();
            rollupRule.ChildActivitySet = "all";
            rollupRule.RollupConditions = new RollupConditions();
            rollupRule.RollupConditions.ListRollupCondition = new List<RollupCondition>();
            RollupCondition rollupCondition = new RollupCondition();
            rollupCondition.Condition = "attempted";
            rollupRule.RollupConditions.ListRollupCondition.Add(rollupCondition);
            rollupRule.RollupAction = new RollupAction();
            rollupRule.RollupAction.Action = "completed";
            rollupRules.ListRollupRule.Add(rollupRule);

            Objectives objectives = new Objectives();
            PrimaryObjective primaryObjective = new PrimaryObjective();
            primaryObjective.SatisfiedByMeasure = "true";
            primaryObjective.MinNormalizedMeasure = "0.6";
            objectives.PrimaryObjective = primaryObjective;

            examSequencing.ControlMode = controlMode;
            examSequencing.RollupRules = rollupRules;
            examSequencing.Objectives = objectives;

            return examSequencing;
        }
        public Presentation buildQuestionPresentationForLinearControlTemplate()
        {
            /*
                <adlnav:presentation>
                 <adlnav:navigationInterface>
                    <adlnav:hideLMSUI>previous</adlnav:hideLMSUI>
                    <adlnav:hideLMSUI>continue</adlnav:hideLMSUI>
                 </adlnav:navigationInterface>
              </adlnav:presentation>
             */
            Presentation presentation = new Presentation();
            NavigationInterface nv = new NavigationInterface();
            nv.ListHideLMSUI = new List<string>();
            nv.ListHideLMSUI.Add("previous");
            nv.ListHideLMSUI.Add("previous");
            presentation.NavigationInterface = nv;
            return presentation;
        }
        public Sequencing buildCourseSequencingForLinearControlTemplate()
        {
            /*
              <imsss:sequencing>
            <imsss:controlMode choice="false" flow="true"/>
            <imsss:sequencingRules>
               <imsss:exitConditionRule>
                  <imsss:ruleConditions>
                     <imsss:ruleCondition condition="completed"/>
                  </imsss:ruleConditions>
                  <imsss:ruleAction action="exit"/>
               </imsss:exitConditionRule>
            </imsss:sequencingRules>
            <imsss:rollupRules >
               <imsss:rollupRule childActivitySet="all">
                  <imsss:rollupConditions>
                     <imsss:rollupCondition condition="satisfied"/>
                  </imsss:rollupConditions>
                  <imsss:rollupAction action="satisfied"/>
               </imsss:rollupRule>
               <imsss:rollupRule childActivitySet="any">
                  <imsss:rollupConditions>
                     <imsss:rollupCondition operator ="not" condition="satisfied"/>
                  </imsss:rollupConditions>
                  <imsss:rollupAction action="notSatisfied"/>
               </imsss:rollupRule>
            </imsss:rollupRules>
         </imsss:sequencing>
             */
            Sequencing courseSequencing = new Sequencing();
            ControlMode controlMode = new ControlMode();
            controlMode.Choice = "false";
            controlMode.Flow = "true";
            courseSequencing.ControlMode = controlMode;

            SequencingRules sequencingRules = new SequencingRules();
            sequencingRules.ListExitConditionRule = new List<ExitConditionRule>();
            ExitConditionRule exitConditionRule = new ExitConditionRule();
            exitConditionRule.RuleConditions = new RuleConditions();
            exitConditionRule.RuleConditions.ListRuleCondition = new List<RuleCondition>();
            RuleCondition ruleCondition = new RuleCondition();
            ruleCondition.Condition = "completed";
            exitConditionRule.RuleConditions.ListRuleCondition.Add(ruleCondition);
            exitConditionRule.RuleAction = new RuleAction();
            exitConditionRule.RuleAction.Action = "exit";
            sequencingRules.ListExitConditionRule.Add(exitConditionRule);
            courseSequencing.SequencingRules = sequencingRules;

            RollupRules rollupRules = new RollupRules();
            rollupRules.RollupObjectiveSatisfied = "false";
            rollupRules.ListRollupRule = new List<RollupRule>();

            RollupRule rollupRule = new RollupRule();
            rollupRule.ChildActivitySet = "all";
            rollupRule.RollupConditions = new RollupConditions();
            rollupRule.RollupConditions.ListRollupCondition = new List<RollupCondition>();
            RollupCondition rollupCondition = new RollupCondition();
            rollupCondition.Condition = "satisfied";
            rollupRule.RollupConditions.ListRollupCondition.Add(rollupCondition);
            rollupRule.RollupAction = new RollupAction();
            rollupRule.RollupAction.Action = "satisfied";

            RollupRule rollupRule1 = new RollupRule();
            rollupRule1.ChildActivitySet = "any";
            rollupRule1.RollupConditions = new RollupConditions();
            rollupRule1.RollupConditions.ListRollupCondition = new List<RollupCondition>();
            RollupCondition rollupCondition1 = new RollupCondition();
            rollupCondition1.Condition = "satisfied";
            rollupCondition1.Operator = "not";
            rollupRule1.RollupConditions.ListRollupCondition.Add(rollupCondition1);
            rollupRule1.RollupAction = new RollupAction();
            rollupRule1.RollupAction.Action = "satisfied";

            rollupRules.ListRollupRule.Add(rollupRule);
            rollupRules.ListRollupRule.Add(rollupRule1);
            courseSequencing.RollupRules = rollupRules;
            return courseSequencing;
        }
        #endregion
        #region ConstrainedChoice Template
        public Sequencing buildIntroSequencingForConstrainedChoiceTemplate()
        {
            /*
             <imsss:sequencing>
               <imsss:limitConditions attemptLimit = "1" />
               <imsss:rollupRules rollupObjectiveSatisfied="false"/>
            </imsss:sequencing>
             */
            Sequencing introSequencing = new Sequencing();
            LimitConditions limitConditions = new LimitConditions();
            limitConditions.AttemptLimit = "1";
            RollupRules rollupRules = new RollupRules();
            rollupRules.RollupObjectiveSatisfied = "false";

            introSequencing.LimitConditions = limitConditions;
            introSequencing.RollupRules = rollupRules;

            return introSequencing;
        }
        public Sequencing buildLessonSequencingForConstrainedChoiceTemplate()
        {
            /*
                <imsss:sequencing>
                     <imsss:deliveryControls tracked = "false"/>
                  </imsss:sequencing>
               </item>
             */
            Sequencing lessonSequencing = new Sequencing();
            DeliveryControls deliveryControls = new DeliveryControls();
            deliveryControls.Tracked = "false";
            lessonSequencing.DeliveryControls = deliveryControls;

            return lessonSequencing;
        }
        public Sequencing buildExamSequencingForConstrainedChoiceTemplate()
        {
            /*
             <imsss:sequencing>
                     <imsss:controlMode choice="false" choiceExit ="false" flow="true" forwardOnly="true"/>
                     <imsss:rollupRules >
                        <imsss:rollupRule childActivitySet="all">
                           <imsss:rollupConditions>
                              <imsss:rollupCondition condition="attempted"/>
                           </imsss:rollupConditions>
                           <imsss:rollupAction action="completed"/>
                        </imsss:rollupRule>
                     </imsss:rollupRules>
                     <imsss:objectives>
                        <imsss:primaryObjective satisfiedByMeasure="true">
                           <imsss:minNormalizedMeasure>0.6</imsss:minNormalizedMeasure>
                        </imsss:primaryObjective>
                     </imsss:objectives>
                  </imsss:sequencing>
             */
            Sequencing examSequencing = new Sequencing();
            ControlMode controlMode = new ControlMode();
            controlMode.Choice = "false";
            controlMode.ChoiceExit = "false";
            controlMode.Flow = "true";
            controlMode.ForwardOnly = "true";

            RollupRules rollupRules = new RollupRules();
            rollupRules.ListRollupRule = new List<RollupRule>();
            RollupRule rollupRule = new RollupRule();
            rollupRule.ChildActivitySet = "all";
            rollupRule.RollupConditions = new RollupConditions();
            rollupRule.RollupConditions.ListRollupCondition = new List<RollupCondition>();
            RollupCondition rollupCondition = new RollupCondition();
            rollupCondition.Condition = "attempted";
            rollupRule.RollupConditions.ListRollupCondition.Add(rollupCondition);
            rollupRule.RollupAction = new RollupAction();
            rollupRule.RollupAction.Action = "completed";
            rollupRules.ListRollupRule.Add(rollupRule);

            Objectives objectives = new Objectives();
            PrimaryObjective primaryObjective = new PrimaryObjective();
            primaryObjective.SatisfiedByMeasure = "true";
            primaryObjective.MinNormalizedMeasure = "0.6";
            objectives.PrimaryObjective = primaryObjective;

            examSequencing.ControlMode = controlMode;
            examSequencing.RollupRules = rollupRules;
            examSequencing.Objectives = objectives;

            return examSequencing;
        }
        public Sequencing buildModuleSequencingForConstrainedChoiceTemplate()
        {
            /*
             <imsss:sequencing>
               <imsss:controlMode flow = "true"/>
               <imsss:sequencingRules>
                  <imsss:exitConditionRule>
                     <imsss:ruleConditions>
                        <imsss:ruleCondition condition = "completed"/>
                     </imsss:ruleConditions>
                     <imsss:ruleAction action = "exit"/>
                  </imsss:exitConditionRule>
               </imsss:sequencingRules>
               <adlseq:constrainedChoiceConsiderations  constrainChoice = "true" />
            </imsss:sequencing>
             */
            Sequencing moduleSequencing = new Sequencing();

            ControlMode controlMode = new ControlMode();
            controlMode.Choice = "false";
            controlMode.ChoiceExit = "false";
            controlMode.Flow = "true";

            SequencingRules sequencingRules = new SequencingRules();
            sequencingRules.ListExitConditionRule = new List<ExitConditionRule>();

            ExitConditionRule exitConRule = new ExitConditionRule();
            RuleConditions exitRuleCons = new RuleConditions();
            RuleCondition exitRuleCon = new RuleCondition();
            exitRuleCon.Condition = "completed";
            exitRuleCons.ListRuleCondition = new List<RuleCondition>();
            exitRuleCons.ListRuleCondition.Add(exitRuleCon);
            exitConRule.RuleConditions = exitRuleCons;
            exitConRule.RuleAction = new RuleAction();
            exitConRule.RuleAction.Action = "exit";

            sequencingRules.ListExitConditionRule.Add(exitConRule);

            ConstrainedChoiceConsiderations ccc = new ConstrainedChoiceConsiderations();
            ccc.ConstrainChoice = "true";
            moduleSequencing.ControlMode = controlMode;
            moduleSequencing.SequencingRules = sequencingRules;
            moduleSequencing.ConstrainedChoiceConsiderations = ccc;
            return moduleSequencing;
        }
        public Sequencing buildCourseSequencingForConstrainedChoiceTemplate()
        {
            /*
                 <imsss:sequencing>
            <imsss:controlMode flow="true"/>
            <imsss:sequencingRules>
               <imsss:exitConditionRule>
                  <imsss:ruleConditions>
                     <imsss:ruleCondition condition="completed"/>
                  </imsss:ruleConditions>
                  <imsss:ruleAction action="exit"/>
               </imsss:exitConditionRule>
            </imsss:sequencingRules>
            <imsss:rollupRules >
               <imsss:rollupRule childActivitySet="any">
                  <imsss:rollupConditions>
                     <imsss:rollupCondition operator ="not" condition="satisfied"/>
                  </imsss:rollupConditions>
                  <imsss:rollupAction action="notSatisfied"/>
               </imsss:rollupRule>
            </imsss:rollupRules>
         </imsss:sequencing>
             */
            Sequencing courseSequencing = new Sequencing();
            ControlMode controlMode = new ControlMode();
            controlMode.Flow = "true";

            SequencingRules sequencingRules = new SequencingRules();
            sequencingRules.ListExitConditionRule = new List<ExitConditionRule>();
            ExitConditionRule exitConRule = new ExitConditionRule();
            RuleConditions exitRuleCons = new RuleConditions();
            RuleCondition exitRuleCon = new RuleCondition();
            exitRuleCon.Condition = "completed";
            exitRuleCons.ListRuleCondition = new List<RuleCondition>();
            exitRuleCons.ListRuleCondition.Add(exitRuleCon);
            exitConRule.RuleConditions = exitRuleCons;
            exitConRule.RuleAction = new RuleAction();
            exitConRule.RuleAction.Action = "exit";
            sequencingRules.ListExitConditionRule.Add(exitConRule);

            RollupRules rollupRules = new RollupRules();
            rollupRules.ListRollupRule = new List<RollupRule>();
            RollupRule rollupRule = new RollupRule();
            rollupRule.ChildActivitySet = "any";
            rollupRule.RollupConditions = new RollupConditions();
            rollupRule.RollupConditions.ListRollupCondition = new List<RollupCondition>();
            RollupCondition rollupCondition = new RollupCondition();
            rollupCondition.Condition = "satisfied";
            rollupCondition.Operator = "not";
            rollupRule.RollupConditions.ListRollupCondition.Add(rollupCondition);
            rollupRule.RollupAction = new RollupAction();
            rollupRule.RollupAction.Action = "notSatisfied";
            rollupRules.ListRollupRule.Add(rollupRule);

            courseSequencing.ControlMode = controlMode;
            courseSequencing.SequencingRules = sequencingRules;
            courseSequencing.RollupRules = rollupRules;

            return courseSequencing;
        }
        #endregion
        #region Competency Template
        public static Sequencing buildIntroSequencingForCompetencyTemplate()
        {
            /*
             <imsss:sequencing>
               <imsss:rollupRules rollupObjectiveSatisfied="false"/>
            </imsss:sequencing>
             */
            Sequencing introSequencing = new Sequencing();
            RollupRules rollupRules = new RollupRules();
            rollupRules.RollupObjectiveSatisfied = "false";

            introSequencing.RollupRules = rollupRules;

            return introSequencing;
        }
        public static Sequencing buildCourseSequencingForCompetencyTemplate()
        {
            /*
                 <imsss:sequencing>
            <imsss:controlMode choice="false" flow="true" forwardOnly="true"/>
            <imsss:sequencingRules>
               <imsss:exitConditionRule>
                  <imsss:ruleConditions>
                     <imsss:ruleCondition condition="completed"/>
                  </imsss:ruleConditions>
                  <imsss:ruleAction action="exit"/>
               </imsss:exitConditionRule>
            </imsss:sequencingRules>
            <imsss:rollupRules >
               <imsss:rollupRule childActivitySet="any">
                  <imsss:rollupConditions>
                     <imsss:rollupCondition operator ="not" condition="satisfied"/>
                  </imsss:rollupConditions>
                  <imsss:rollupAction action="notSatisfied"/>
               </imsss:rollupRule>
            </imsss:rollupRules>
         </imsss:sequencing>
             */
            Sequencing courseSequencing = new Sequencing();
            ControlMode controlMode = new ControlMode();
            controlMode.Flow = "true";
            controlMode.Choice = "false";
            controlMode.ForwardOnly = "true";

            SequencingRules sequencingRules = new SequencingRules();
            sequencingRules.ListExitConditionRule = new List<ExitConditionRule>();
            ExitConditionRule exitConRule = new ExitConditionRule();
            RuleConditions exitRuleCons = new RuleConditions();
            RuleCondition exitRuleCon = new RuleCondition();
            exitRuleCon.Condition = "completed";
            exitRuleCons.ListRuleCondition = new List<RuleCondition>();
            exitRuleCons.ListRuleCondition.Add(exitRuleCon);
            exitConRule.RuleConditions = exitRuleCons;
            exitConRule.RuleAction = new RuleAction();
            exitConRule.RuleAction.Action = "exit";
            sequencingRules.ListExitConditionRule.Add(exitConRule);

            RollupRules rollupRules = new RollupRules();
            rollupRules.ListRollupRule = new List<RollupRule>();
            RollupRule rollupRule = new RollupRule();
            rollupRule.ChildActivitySet = "any";
            rollupRule.RollupConditions = new RollupConditions();
            rollupRule.RollupConditions.ListRollupCondition = new List<RollupCondition>();
            RollupCondition rollupCondition = new RollupCondition();
            rollupCondition.Condition = "attempted";
            rollupCondition.Operator = "not";
            rollupRule.RollupConditions.ListRollupCondition.Add(rollupCondition);
            rollupRule.RollupAction = new RollupAction();
            rollupRule.RollupAction.Action = "notSatisfied";
            rollupRules.ListRollupRule.Add(rollupRule);

            courseSequencing.ControlMode = controlMode;
            courseSequencing.SequencingRules = sequencingRules;
            courseSequencing.RollupRules = rollupRules;

            return courseSequencing;
        }
        public static Sequencing buildModuleSequencingForCompetencyTemplate(string objTarget)
        {
            /*
                <imsss:sequencing>
               <imsss:controlMode choice="false" flow="true"/>
               <imsss:sequencingRules>
                  <imsss:preConditionRule>
                     <imsss:ruleConditions>
                        <imsss:ruleCondition condition="satisfied"/>
                     </imsss:ruleConditions>
                     <imsss:ruleAction action="skip"/>
                  </imsss:preConditionRule>
               </imsss:sequencingRules>
               <imsss:rollupRules rollupObjectiveSatisfied="false" />
               <imsss:objectives>
                  <imsss:primaryObjective objectiveID = "PRIMARYOBJ">
                     <imsss:mapInfo targetObjectiveID="obj_module_1" readNormalizedMeasure = "false"/>
                  </imsss:primaryObjective>
               </imsss:objectives>
               <adlseq:rollupConsiderations requiredForCompleted = "ifNotSkipped" />
            </imsss:sequencing>
             */
            Sequencing se = new Sequencing();

            ControlMode controlMode = new ControlMode();
            controlMode.Choice = "false";
            controlMode.Flow = "true";


            SequencingRules srs = new SequencingRules();
            srs.ListPreConditionRule = new List<PreConditionRule>();
            PreConditionRule pcr = new PreConditionRule();
            srs.ListPreConditionRule.Add(pcr);
            pcr.RuleConditions = new RuleConditions();
            RuleCondition rc = new RuleCondition();
            rc.Condition = "satisfied";
            pcr.RuleAction = new RuleAction();
            pcr.RuleAction.Action = "skip";
            pcr.RuleConditions.ListRuleCondition = new List<RuleCondition>();
            pcr.RuleConditions.ListRuleCondition.Add(rc);

            RollupRules rrs = new RollupRules();
            rrs.RollupObjectiveSatisfied = "false";


            Objectives objs = new Objectives();
            PrimaryObjective po = new PrimaryObjective();
            objs.PrimaryObjective = po;
            po.ObjectiveID = "PRIMARYOBJ";
            MapInfo mi = new MapInfo();
            mi.TargetObjectiveID = "obj_" + objTarget;
            mi.ReadNormalizedMeasure = "false";
            po.ListMapInfo = new List<MapInfo>();
            po.ListMapInfo.Add(mi);

            RollupConsiderations roCon = new RollupConsiderations();
            roCon.RequiredForCompleted = "ifNotSkipped";

            se.ControlMode = controlMode;
            se.SequencingRules = srs;
            se.RollupRules = rrs;
            se.Objectives = objs;
            se.RollupConsiderations = roCon;

            return se;
        }
        public static Sequencing buildExamPartSequencingForCompetencyTemplate(string objTarget)
        {
            /*
                <imsss:sequencing>
                  <imsss:controlMode choice="false" flow="true" forwardOnly="true"/>
                  <imsss:sequencingRules>
                     <imsss:preConditionRule>
                        <imsss:ruleConditions>
                           <imsss:ruleCondition condition="satisfied"/>
                        </imsss:ruleConditions>
                        <imsss:ruleAction action="skip"/>
                     </imsss:preConditionRule>
                  </imsss:sequencingRules>
                  <imsss:objectives>
                     <imsss:primaryObjective objectiveID = "PRIMARYOBJ" satisfiedByMeasure="true">
                        <imsss:minNormalizedMeasure>0.6</imsss:minNormalizedMeasure>
                        <imsss:mapInfo targetObjectiveID="obj_module_3" readNormalizedMeasure = "false" writeSatisfiedStatus = "true" />
                     </imsss:primaryObjective>
                  </imsss:objectives>
                  <adlseq:rollupConsiderations requiredForCompleted = "ifNotSkipped" />
               </imsss:sequencing>
             */
            Sequencing se = new Sequencing();
            ControlMode controlMode = new ControlMode();
            controlMode.Choice = "false";
            controlMode.Flow = "true";
            controlMode.ForwardOnly = "true";

            SequencingRules srs = new SequencingRules();
            srs.ListPreConditionRule = new List<PreConditionRule>();
            PreConditionRule pcr = new PreConditionRule();
            srs.ListPreConditionRule.Add(pcr);
            pcr.RuleConditions = new RuleConditions();
            RuleCondition rc = new RuleCondition();
            rc.Condition = "satisfied";
            pcr.RuleAction = new RuleAction();
            pcr.RuleAction.Action = "skip";
            pcr.RuleConditions.ListRuleCondition = new List<RuleCondition>();
            pcr.RuleConditions.ListRuleCondition.Add(rc);

            Objectives objs = new Objectives();
            PrimaryObjective po = new PrimaryObjective();
            objs.PrimaryObjective = po;
            po.ObjectiveID = "PRIMARYOBJ";
            po.SatisfiedByMeasure = "true";
            po.MinNormalizedMeasure = "0.6";
            MapInfo mi = new MapInfo();
            mi.TargetObjectiveID = "obj_" + objTarget;
            mi.ReadNormalizedMeasure = "false";
            mi.WriteSatisfiedStatus = "true";
            po.ListMapInfo = new List<MapInfo>();
            po.ListMapInfo.Add(mi);

            RollupConsiderations roCon = new RollupConsiderations();
            roCon.RequiredForCompleted = "ifNotSkipped";
            return se;
        }
        #endregion
        #region KnowledgePaced Template
        public Sequencing buildIntroSequencingForKnowledgePacedTemplate()
        {
            /*
              <imsss:sequencing>
               <imsss:limitConditions attemptLimit = "1" />
               <imsss:rollupRules rollupObjectiveSatisfied="false"/>
              </imsss:sequencing>
             */
            Sequencing introSequencing = new Sequencing();
            LimitConditions limitConditions = new LimitConditions();
            limitConditions.AttemptLimit = "1";
            RollupRules rollupRules = new RollupRules();
            rollupRules.RollupObjectiveSatisfied = "false";

            introSequencing.LimitConditions = limitConditions;
            introSequencing.RollupRules = rollupRules;

            return introSequencing;
        }
        public Sequencing buildModuleSequencingForKnowledgePacedTemplate()
        {
            /*
             <imsss:sequencing>
                  <imsss:controlMode flow = "true"/>
                  <imsss:sequencingRules>
                     <imsss:exitConditionRule>
                        <imsss:ruleConditions>
                           <imsss:ruleCondition condition="completed"/>
                        </imsss:ruleConditions>
                        <imsss:ruleAction action="exit"/>
                     </imsss:exitConditionRule>
                  </imsss:sequencingRules>
               </imsss:sequencing>
             */
            Sequencing moduleSequencing = new Sequencing();

            ControlMode controlMode = new ControlMode();
            controlMode.Flow = "true";

            SequencingRules sequencingRules = new SequencingRules();
            sequencingRules.ListExitConditionRule = new List<ExitConditionRule>();

            ExitConditionRule exitConRule = new ExitConditionRule();
            RuleConditions exitRuleCons = new RuleConditions();
            RuleCondition exitRuleCon = new RuleCondition();
            exitRuleCon.Condition = "completed";
            exitRuleCons.ListRuleCondition = new List<RuleCondition>();
            exitRuleCons.ListRuleCondition.Add(exitRuleCon);
            exitConRule.RuleConditions = exitRuleCons;
            exitConRule.RuleAction = new RuleAction();
            exitConRule.RuleAction.Action = "exit";

            sequencingRules.ListExitConditionRule.Add(exitConRule);
            moduleSequencing.SequencingRules = sequencingRules;
            return moduleSequencing;
        }
        public Sequencing buildPretestSequencingForKnowledgePacedTemplate(string targetObj)
        {
            /*
              <imsss:sequencing>
                     <imsss:controlMode choice = "false" choiceExit = "false" flow = "true" forwardOnly = "true"/>
                     <imsss:sequencingRules>
                        <imsss:preConditionRule>
                           <imsss:ruleConditions>
                              <imsss:ruleCondition condition = "completed"/>
                           </imsss:ruleConditions>
                           <imsss:ruleAction action = "disabled"/>
                        </imsss:preConditionRule>
                        <imsss:preConditionRule>
                           <imsss:ruleConditions>
                              <imsss:ruleCondition condition = "satisfied"/>
                           </imsss:ruleConditions>
                           <imsss:ruleAction action = "skip"/>
                        </imsss:preConditionRule>
                     </imsss:sequencingRules>
                     <imsss:limitConditions attemptLimit = "1" />
                     <imsss:rollupRules >
                        <imsss:rollupRule childActivitySet = "all">
                           <imsss:rollupConditions>
                              <imsss:rollupCondition condition = "attempted"/>
                           </imsss:rollupConditions>
                           <imsss:rollupAction action = "completed"/>
                        </imsss:rollupRule>
                     </imsss:rollupRules>
                     <imsss:objectives>
                        <imsss:primaryObjective objectiveID = "PRIMARYOBJ" satisfiedByMeasure = "true">
                           <imsss:minNormalizedMeasure>0.6</imsss:minNormalizedMeasure>
                           <imsss:mapInfo targetObjectiveID = "obj_module_1" readNormalizedMeasure = "false" writeSatisfiedStatus = "true" writeNormalizedMeasure = "true"  />
                        </imsss:primaryObjective>
                     </imsss:objectives>
                     <adlseq:rollupConsiderations  requiredForCompleted = "ifAttempted" />
                  </imsss:sequencing>
             */
            Sequencing pretestSequencing = new Sequencing();
            ControlMode controlMode = new ControlMode();
            controlMode.Choice = "false";
            controlMode.ChoiceExit = "false";
            controlMode.Flow = "true";
            controlMode.ForwardOnly = "true";
            SequencingRules sequencingRules = new SequencingRules();
            PreConditionRule preConRule = new PreConditionRule();
            RuleConditions preRuleCons = new RuleConditions();
            RuleCondition preRuleCon = new RuleCondition();
            preRuleCon.Condition = "completed";
            preRuleCons.ListRuleCondition = new List<RuleCondition>();
            preRuleCons.ListRuleCondition.Add(preRuleCon);
            preConRule.RuleConditions = preRuleCons;
            preConRule.RuleAction = new RuleAction();
            preConRule.RuleAction.Action = "disabled";

            PreConditionRule preConRule1 = new PreConditionRule();
            RuleConditions preRuleCons1 = new RuleConditions();
            RuleCondition preRuleCon1 = new RuleCondition();
            preRuleCon1.Condition = "satisfied";
            preRuleCons1.ListRuleCondition = new List<RuleCondition>();
            preRuleCons1.ListRuleCondition.Add(preRuleCon1);
            preConRule1.RuleConditions = preRuleCons1;
            preConRule1.RuleAction = new RuleAction();
            preConRule1.RuleAction.Action = "skip";

            sequencingRules.ListPreConditionRule = new List<PreConditionRule>();
            sequencingRules.ListPreConditionRule.Add(preConRule);
            sequencingRules.ListPreConditionRule.Add(preConRule1);

            LimitConditions limitConditions = new LimitConditions();
            limitConditions.AttemptLimit = "1";

            RollupRules rollupRules = new RollupRules();
            rollupRules.ListRollupRule = new List<RollupRule>();
            RollupRule rollupRule = new RollupRule();
            rollupRule.ChildActivitySet = "all";
            rollupRule.RollupConditions = new RollupConditions();
            rollupRule.RollupConditions.ListRollupCondition = new List<RollupCondition>();
            RollupCondition rollupCondition = new RollupCondition();
            rollupCondition.Condition = "attempted";
            rollupRule.RollupConditions.ListRollupCondition.Add(rollupCondition);
            rollupRule.RollupAction = new RollupAction();
            rollupRule.RollupAction.Action = "completed";
            rollupRules.ListRollupRule.Add(rollupRule);

            Objectives objectives = new Objectives();
            PrimaryObjective primaryObjective = new PrimaryObjective();
            primaryObjective.ObjectiveID = "PRIMARYOBJ";
            primaryObjective.SatisfiedByMeasure = "true";
            primaryObjective.MinNormalizedMeasure = "0.6";
            MapInfo mapInfo= new MapInfo();
            mapInfo.ReadNormalizedMeasure = "false";
            mapInfo.WriteNormalizedMeasure = "true";
            mapInfo.WriteSatisfiedStatus = "true";
            mapInfo.TargetObjectiveID = "obj_" + targetObj;
            primaryObjective.ListMapInfo = new List<MapInfo>();
            primaryObjective.ListMapInfo.Add(mapInfo);
            objectives.PrimaryObjective = primaryObjective;

            RollupConsiderations rollupConsideration = new RollupConsiderations();
            rollupConsideration.RequiredForCompleted = "ifAttempted";

            pretestSequencing.ControlMode = controlMode;
            pretestSequencing.SequencingRules = sequencingRules;
            pretestSequencing.LimitConditions = limitConditions;
            pretestSequencing.RollupRules = rollupRules;
            pretestSequencing.Objectives = objectives;
            pretestSequencing.RollupConsiderations = rollupConsideration;
            return pretestSequencing;
        }
        public Sequencing buildLessonSequencingForKnowledgePacedTemplate(string targetObj)
        {
            /*
              <imsss:sequencing>
                     <imsss:controlMode flow="true"/>
                     <imsss:sequencingRules>
                        <imsss:preConditionRule>
                           <imsss:ruleConditions>
                              <imsss:ruleCondition condition = "satisfied"/>
                           </imsss:ruleConditions>
                           <imsss:ruleAction action = "skip"/>
                        </imsss:preConditionRule>
                     </imsss:sequencingRules>
                     <imsss:rollupRules rollupObjectiveSatisfied="false" rollupProgressCompletion = "false" />
                     <imsss:objectives>
                        <imsss:primaryObjective objectiveID = "PRIMARYOBJ">
                           <imsss:mapInfo targetObjectiveID = "obj_module_1" readNormalizedMeasure = "false"/>
                        </imsss:primaryObjective>
                     </imsss:objectives>
                  </imsss:sequencing>
             */
            Sequencing lessonSequencing = new Sequencing();
            ControlMode controlMode = new ControlMode();
            controlMode.Flow = "true";
            SequencingRules sequencingRules = new SequencingRules();
            PreConditionRule preConRule = new PreConditionRule();
            RuleConditions preRuleCons = new RuleConditions();
            RuleCondition preRuleCon = new RuleCondition();
            preRuleCon.Condition = "satisfied";
            preRuleCons.ListRuleCondition = new List<RuleCondition>();
            preRuleCons.ListRuleCondition.Add(preRuleCon);
            preConRule.RuleConditions = preRuleCons;
            preConRule.RuleAction = new RuleAction();
            preConRule.RuleAction.Action = "skip";

            sequencingRules.ListPreConditionRule = new List<PreConditionRule>();
            sequencingRules.ListPreConditionRule.Add(preConRule);

            RollupRules rollupRules = new RollupRules();
            rollupRules.RollupObjectiveSatisfied = "false";
            rollupRules.RollupProgressCompletion = "false";

            Objectives objectives = new Objectives();
            PrimaryObjective primaryObjective = new PrimaryObjective();
            primaryObjective.ObjectiveID = "PRIMARYOBJ";
            primaryObjective.SatisfiedByMeasure = "true";
            MapInfo mapInfo = new MapInfo();
            mapInfo.ReadNormalizedMeasure = "false";
            mapInfo.TargetObjectiveID = "obj_" + targetObj;
            primaryObjective.ListMapInfo = new List<MapInfo>();
            primaryObjective.ListMapInfo.Add(mapInfo);
            objectives.PrimaryObjective = primaryObjective;

            lessonSequencing.ControlMode = controlMode;
            lessonSequencing.SequencingRules = sequencingRules;
            lessonSequencing.RollupRules = rollupRules;
            lessonSequencing.Objectives = objectives;

            return lessonSequencing;
        }
        public Sequencing buildPosttestSequencingForKnowledgePacedTemplate(string targetObj)
        {
            /*
              <imsss:sequencing>
                     <imsss:controlMode choice = "false" choiceExit = "false" flow = "true" forwardOnly = "true"/>
                     <imsss:sequencingRules>
                        <imsss:preConditionRule>
                           <imsss:ruleConditions>
                              <imsss:ruleCondition condition = "always"/>
                           </imsss:ruleConditions>
                           <imsss:ruleAction action = "hiddenFromChoice"/>
                        </imsss:preConditionRule>
                        <imsss:preConditionRule>
                           <imsss:ruleConditions>
                              <imsss:ruleCondition condition = "satisfied"/>
                           </imsss:ruleConditions>
                           <imsss:ruleAction action = "skip"/>
                        </imsss:preConditionRule>
                     </imsss:sequencingRules>
                     <imsss:limitConditions attemptLimit = "1" />
                     <imsss:rollupRules >
                        <imsss:rollupRule childActivitySet = "all">
                           <imsss:rollupConditions>
                              <imsss:rollupCondition condition = "attempted"/>
                           </imsss:rollupConditions>
                           <imsss:rollupAction action = "completed"/>
                        </imsss:rollupRule>
                     </imsss:rollupRules>
                     <imsss:objectives>
                        <imsss:primaryObjective objectiveID = "PRIMARYOBJ" satisfiedByMeasure = "true">
                           <imsss:minNormalizedMeasure>0.6</imsss:minNormalizedMeasure>
                           <imsss:mapInfo targetObjectiveID = "obj_module_1" readNormalizedMeasure = "false" writeSatisfiedStatus = "true" writeNormalizedMeasure = "true"  />
                        </imsss:primaryObjective>
                     </imsss:objectives>
                     <adlseq:rollupConsiderations  requiredForCompleted = "ifNotSkipped" />
                  </imsss:sequencing>
             */
            Sequencing posttestSequencing = new Sequencing();
            ControlMode controlMode = new ControlMode();
            controlMode.Choice = "false";
            controlMode.ChoiceExit = "false";
            controlMode.Flow = "true";
            controlMode.ForwardOnly = "true";
            SequencingRules sequencingRules = new SequencingRules();
            PreConditionRule preConRule = new PreConditionRule();
            RuleConditions preRuleCons = new RuleConditions();
            RuleCondition preRuleCon = new RuleCondition();
            preRuleCon.Condition = "always";
            preRuleCons.ListRuleCondition = new List<RuleCondition>();
            preRuleCons.ListRuleCondition.Add(preRuleCon);
            preConRule.RuleConditions = preRuleCons;
            preConRule.RuleAction = new RuleAction();
            preConRule.RuleAction.Action = "hiddenFromChoice";

            PreConditionRule preConRule1 = new PreConditionRule();
            RuleConditions preRuleCons1 = new RuleConditions();
            RuleCondition preRuleCon1 = new RuleCondition();
            preRuleCon1.Condition = "satisfied";
            preRuleCons1.ListRuleCondition = new List<RuleCondition>();
            preRuleCons1.ListRuleCondition.Add(preRuleCon1);
            preConRule1.RuleConditions = preRuleCons1;
            preConRule1.RuleAction = new RuleAction();
            preConRule1.RuleAction.Action = "skip";

            sequencingRules.ListPreConditionRule = new List<PreConditionRule>();
            sequencingRules.ListPreConditionRule.Add(preConRule);
            sequencingRules.ListPreConditionRule.Add(preConRule1);

            LimitConditions limitConditions = new LimitConditions();
            limitConditions.AttemptLimit = "1";

            RollupRules rollupRules = new RollupRules();
            rollupRules.ListRollupRule = new List<RollupRule>();
            RollupRule rollupRule = new RollupRule();
            rollupRule.ChildActivitySet = "all";
            rollupRule.RollupConditions = new RollupConditions();
            rollupRule.RollupConditions.ListRollupCondition = new List<RollupCondition>();
            RollupCondition rollupCondition = new RollupCondition();
            rollupCondition.Condition = "attempted";
            rollupRule.RollupConditions.ListRollupCondition.Add(rollupCondition);
            rollupRule.RollupAction = new RollupAction();
            rollupRule.RollupAction.Action = "completed";
            rollupRules.ListRollupRule.Add(rollupRule);

            Objectives objectives = new Objectives();
            PrimaryObjective primaryObjective = new PrimaryObjective();
            primaryObjective.ObjectiveID = "PRIMARYOBJ";
            primaryObjective.SatisfiedByMeasure = "true";
            primaryObjective.MinNormalizedMeasure = "0.6";
            MapInfo mapInfo = new MapInfo();
            mapInfo.ReadNormalizedMeasure = "false";
            mapInfo.WriteNormalizedMeasure = "true";
            mapInfo.WriteSatisfiedStatus = "true";
            mapInfo.TargetObjectiveID = "obj_" + targetObj;
            primaryObjective.ListMapInfo = new List<MapInfo>();
            primaryObjective.ListMapInfo.Add(mapInfo);
            objectives.PrimaryObjective = primaryObjective;

            RollupConsiderations rollupConsideration = new RollupConsiderations();
            rollupConsideration.RequiredForCompleted = "ifAttempted";

            posttestSequencing.ControlMode = controlMode;
            posttestSequencing.SequencingRules = sequencingRules;
            posttestSequencing.LimitConditions = limitConditions;
            posttestSequencing.RollupRules = rollupRules;
            posttestSequencing.Objectives = objectives;
            posttestSequencing.RollupConsiderations = rollupConsideration;
            return posttestSequencing;
        }
        #endregion
        #region KnowledgePaced Reused Template
        public Sequencing buildModuleSequencingForKnowledgePacedReusedTemplate()
        {
            /*
             <imsss:sequencing IDRef = "module" />
             */
            Sequencing moduleSequencing = new Sequencing();
            moduleSequencing.Identifier = "module";
            return moduleSequencing;
        }
        public Sequencing buildPretestSequencingForKnowledgePacedReusedTemplate(string targetObj)
        {
            /*
             <imsss:sequencing IDRef = "pretest">
                     <imsss:objectives>
                        <imsss:primaryObjective objectiveID = "PRIMARYOBJ" satisfiedByMeasure = "true">
                           <imsss:minNormalizedMeasure>0.6</imsss:minNormalizedMeasure>
                           <imsss:mapInfo targetObjectiveID = "obj_module_1" readNormalizedMeasure = "false" writeSatisfiedStatus = "true" writeNormalizedMeasure = "true"  />
                        </imsss:primaryObjective>
                     </imsss:objectives>
                  </imsss:sequencing>
             */
            Sequencing pretestSequencing = new Sequencing();
            pretestSequencing.Identifier = "pretest";

            Objectives objectives = new Objectives();
            PrimaryObjective primaryObjective = new PrimaryObjective();
            primaryObjective.ObjectiveID = "PRIMARYOBJ";
            primaryObjective.SatisfiedByMeasure = "true";
            primaryObjective.MinNormalizedMeasure = "0.6";
            MapInfo mapInfo = new MapInfo();
            mapInfo.ReadNormalizedMeasure = "false";
            mapInfo.WriteNormalizedMeasure = "true";
            mapInfo.WriteSatisfiedStatus = "true";
            mapInfo.TargetObjectiveID = "obj_" + targetObj;
            primaryObjective.ListMapInfo = new List<MapInfo>();
            primaryObjective.ListMapInfo.Add(mapInfo);
            objectives.PrimaryObjective = primaryObjective;

            pretestSequencing.Objectives = objectives;

            return pretestSequencing;
        }
        public Sequencing buildLessonSequencingForKnowledgePacedReusedTemplate(string targetObj)
        {
            /*
              <imsss:sequencing IDRef = "lessons">
                     <imsss:objectives>
                        <imsss:primaryObjective objectiveID = "PRIMARYOBJ">
                           <imsss:mapInfo targetObjectiveID = "obj_module_1" readNormalizedMeasure = "false"/>
                        </imsss:primaryObjective>
                     </imsss:objectives>
                  </imsss:sequencing>
             */
            Sequencing lessonSequencing = new Sequencing();
            lessonSequencing.Identifier = "lessons";

            Objectives objectives = new Objectives();
            PrimaryObjective primaryObjective = new PrimaryObjective();
            primaryObjective.ObjectiveID = "PRIMARYOBJ";
            primaryObjective.SatisfiedByMeasure = "true";
            MapInfo mapInfo = new MapInfo();
            mapInfo.ReadNormalizedMeasure = "false";
            mapInfo.TargetObjectiveID = "obj_" + targetObj;
            primaryObjective.ListMapInfo = new List<MapInfo>();
            primaryObjective.ListMapInfo.Add(mapInfo);
            objectives.PrimaryObjective = primaryObjective;

            lessonSequencing.Objectives = objectives;

            return lessonSequencing;
        }
        public Sequencing buildPosttestSequencingForKnowledgePacedReusedTemplate(string targetObj)
        {
            /*
               <imsss:sequencing IDRef = "posttest">
                     <imsss:objectives>
                        <imsss:primaryObjective objectiveID = "PRIMARYOBJ" satisfiedByMeasure = "true">
                           <imsss:minNormalizedMeasure>0.6</imsss:minNormalizedMeasure>
                           <imsss:mapInfo targetObjectiveID = "obj_module_1" readNormalizedMeasure = "false" writeSatisfiedStatus = "true" writeNormalizedMeasure = "true"  />
                        </imsss:primaryObjective>
                     </imsss:objectives>
                  </imsss:sequencing>
             */
            Sequencing posttestSequencing = new Sequencing();
            posttestSequencing.Identifier = "posttest";
         
            Objectives objectives = new Objectives();
            PrimaryObjective primaryObjective = new PrimaryObjective();
            primaryObjective.ObjectiveID = "PRIMARYOBJ";
            primaryObjective.SatisfiedByMeasure = "true";
            primaryObjective.MinNormalizedMeasure = "0.6";
            MapInfo mapInfo = new MapInfo();
            mapInfo.ReadNormalizedMeasure = "false";
            mapInfo.WriteNormalizedMeasure = "true";
            mapInfo.WriteSatisfiedStatus = "true";
            mapInfo.TargetObjectiveID = "obj_" + targetObj;
            primaryObjective.ListMapInfo = new List<MapInfo>();
            primaryObjective.ListMapInfo.Add(mapInfo);
            objectives.PrimaryObjective = primaryObjective;
            posttestSequencing.Objectives = objectives;
            return posttestSequencing;
        }
        #endregion
        #region Remediation Template
        public static Sequencing buildIntroSequencingForRemediationTemplate()
        {
            /*
             <imsss:sequencing>
               <imsss:rollupRules rollupObjectiveSatisfied="false"/>
            </imsss:sequencing>
             */
            Sequencing se = new Sequencing();
            se.RollupRules = new RollupRules();
            se.RollupRules.RollupObjectiveSatisfied = "false";
            return se;
        }
        public static Sequencing buildModuleSequencingForRemediationTemplate()
        {
            /*
                <imsss:sequencing>
               <imsss:controlMode choice="false" flow="true"/>
               <imsss:rollupRules rollupObjectiveSatisfied="false"/>
            </imsss:sequencing>
             */
            Sequencing se = new Sequencing();
            return se;
        }
        public static Sequencing buildFirstExamPartSequencingForRemediationTemplate(string targetObj)
        {
            /*
               <imsss:sequencing>
                  <imsss:controlMode choice="false" flow="true" forwardOnly="true"/>
                  <imsss:rollupRules >
                     <imsss:rollupRule childActivitySet="all">
                        <imsss:rollupConditions>
                           <imsss:rollupCondition condition="attempted"/>
                        </imsss:rollupConditions>
                        <imsss:rollupAction action="completed"/>
                     </imsss:rollupRule>
                  </imsss:rollupRules>
                  <imsss:objectives>
                     <imsss:primaryObjective objectiveID = "PRIMARYOBJ" satisfiedByMeasure="true">
                        <imsss:minNormalizedMeasure>0.6</imsss:minNormalizedMeasure>
                        <imsss:mapInfo targetObjectiveID="obj_module_1" readSatisfiedStatus="false" writeSatisfiedStatus="true" />
                     </imsss:primaryObjective>
                  </imsss:objectives>
               </imsss:sequencing>
             */
            Sequencing se = new Sequencing();

            ControlMode cm = new ControlMode();
            cm.Choice = "false";
            cm.Flow = "true";
            cm.ForwardOnly = "true";

            RollupRules rrs = new RollupRules();
            RollupRule rr = new RollupRule();
            rr.ChildActivitySet = "all";
            rrs.ListRollupRule = new List<RollupRule>();
            rrs.ListRollupRule.Add(rr);
            rr.RollupConditions = new RollupConditions();
            rr.RollupConditions.ListRollupCondition = new List<RollupCondition>();
            RollupCondition rc = new RollupCondition();
            rc.Condition = "attempted";
            rr.RollupConditions.ListRollupCondition.Add(rc);
            rr.RollupAction = new RollupAction();
            rr.RollupAction.Action = "completed";

            Objectives objs = new Objectives();
            PrimaryObjective po = new PrimaryObjective();
            objs.PrimaryObjective = po;
            po.ObjectiveID = "PRIMARYOBJ";
            po.SatisfiedByMeasure = "true";
            po.MinNormalizedMeasure = "0.6";
            MapInfo mi = new MapInfo();
            mi.TargetObjectiveID = "obj_" + targetObj;
            mi.ReadSatisfiedStatus = "false";
            mi.WriteSatisfiedStatus = "true";
            po.ListMapInfo = new List<MapInfo>();
            po.ListMapInfo.Add(mi);

            se.ControlMode = cm;
            se.RollupRules = rrs;
            se.Objectives = objs;
            return se;
        }
        public static Sequencing buildRemediateModuleSequencingForRemediationTemplate(string targetObj)
        {
            /*
               <imsss:sequencing>
               <imsss:controlMode choice="false" flow="true"/>
               <imsss:sequencingRules>
                  <imsss:preConditionRule>
                     <imsss:ruleConditions>
                        <imsss:ruleCondition condition="satisfied"/>
                     </imsss:ruleConditions>
                     <imsss:ruleAction action="skip"/>
                  </imsss:preConditionRule>
               </imsss:sequencingRules>
               <imsss:rollupRules rollupObjectiveSatisfied="false" rollupProgressCompletion = "false" />
               <imsss:objectives>
                  <imsss:primaryObjective objectiveID = "PRIMARYOBJ">
                     <imsss:mapInfo targetObjectiveID="obj_module_1" readSatisfiedStatus="true"/>
                  </imsss:primaryObjective>
               </imsss:objectives>
            </imsss:sequencing>
             */
            Sequencing se = new Sequencing();

            ControlMode cm = new ControlMode();
            cm.Choice = "false";
            cm.Flow = "true";

            SequencingRules srs = new SequencingRules();
            srs.ListPreConditionRule = new List<PreConditionRule>();
            PreConditionRule pcr = new PreConditionRule();
            srs.ListPreConditionRule.Add(pcr);
            pcr.RuleConditions = new RuleConditions();
            RuleCondition rc = new RuleCondition();
            rc.Condition = "satisfied";
            pcr.RuleAction = new RuleAction();
            pcr.RuleAction.Action = "skip";
            pcr.RuleConditions.ListRuleCondition = new List<RuleCondition>();
            pcr.RuleConditions.ListRuleCondition.Add(rc);

            RollupRules rrs = new RollupRules();
            rrs.RollupObjectiveSatisfied = "false";
            rrs.RollupProgressCompletion = "false";


            Objectives objs = new Objectives();
            PrimaryObjective po = new PrimaryObjective();
            objs.PrimaryObjective = po;
            po.ObjectiveID = "PRIMARYOBJ";
            MapInfo mi = new MapInfo();
            mi.TargetObjectiveID = "obj_" + targetObj;
            mi.ReadSatisfiedStatus = "true";
            po.ListMapInfo = new List<MapInfo>();
            po.ListMapInfo.Add(mi);

            se.ControlMode = cm;
            se.SequencingRules = srs;
            se.RollupRules = rrs;
            se.Objectives = objs;

            return se;
        }
        public static Sequencing buildFinalExamPartSequencingForRemediationTemplate(string targetObj)
        {
            /*
              <imsss:sequencing>
                  <imsss:controlMode choice="false" flow="true" forwardOnly="true"/>
                  <imsss:sequencingRules>
                     <imsss:preConditionRule>
                        <imsss:ruleConditions>
                           <imsss:ruleCondition condition="satisfied"/>
                        </imsss:ruleConditions>
                        <imsss:ruleAction action="skip"/>
                     </imsss:preConditionRule>
                  </imsss:sequencingRules>
                  <imsss:rollupRules >
                     <imsss:rollupRule childActivitySet="all">
                        <imsss:rollupConditions>
                           <imsss:rollupCondition condition="attempted"/>
                        </imsss:rollupConditions>
                        <imsss:rollupAction action="completed"/>
                     </imsss:rollupRule>
                  </imsss:rollupRules>
                  <imsss:objectives>
                     <imsss:primaryObjective objectiveID = "PRIMARYOBJ" satisfiedByMeasure="true">
                        <imsss:minNormalizedMeasure>0.6</imsss:minNormalizedMeasure>
                        <imsss:mapInfo targetObjectiveID="obj_module_1" readSatisfiedStatus="true" writeSatisfiedStatus="true" />
                     </imsss:primaryObjective>
                  </imsss:objectives>
                  <adlseq:rollupConsiderations requiredForSatisfied = "ifNotSkipped" requiredForCompleted = "ifNotSkipped"  />
               </imsss:sequencing>
             */
            Sequencing se = new Sequencing();

            ControlMode cm = new ControlMode();
            cm.Choice = "false";
            cm.Flow = "true";
            cm.ForwardOnly = "true";

            SequencingRules srs = new SequencingRules();
            srs.ListPreConditionRule = new List<PreConditionRule>();
            PreConditionRule pcr = new PreConditionRule();
            srs.ListPreConditionRule.Add(pcr);
            pcr.RuleConditions = new RuleConditions();
            RuleCondition rc = new RuleCondition();
            rc.Condition = "satisfied";
            pcr.RuleAction = new RuleAction();
            pcr.RuleAction.Action = "skip";
            pcr.RuleConditions.ListRuleCondition = new List<RuleCondition>();
            pcr.RuleConditions.ListRuleCondition.Add(rc);

            RollupRules rrs = new RollupRules();
            RollupRule rr = new RollupRule();
            rr.ChildActivitySet = "all";
            rrs.ListRollupRule = new List<RollupRule>();
            rrs.ListRollupRule.Add(rr);
            rr.RollupConditions = new RollupConditions();
            rr.RollupConditions.ListRollupCondition = new List<RollupCondition>();
            RollupCondition rc1 = new RollupCondition();
            rc1.Condition = "attempted";
            rr.RollupConditions.ListRollupCondition.Add(rc1);
            rr.RollupAction = new RollupAction();
            rr.RollupAction.Action = "completed";


            Objectives objs = new Objectives();
            PrimaryObjective po = new PrimaryObjective();
            objs.PrimaryObjective = po;
            po.ObjectiveID = "PRIMARYOBJ";
            po.SatisfiedByMeasure = "true";
            po.MinNormalizedMeasure = "0.6";
            MapInfo mi = new MapInfo();
            mi.TargetObjectiveID = "obj_"+targetObj;
            mi.ReadSatisfiedStatus = "true";
            mi.WriteSatisfiedStatus = "true";
            po.ListMapInfo = new List<MapInfo>();
            po.ListMapInfo.Add(mi);

            RollupConsiderations roCon = new RollupConsiderations();
            roCon.RequiredForSatisfied = "ifNotSkipped";
            roCon.RequiredForCompleted = "ifNotSkipped";

            se.ControlMode = cm;
            se.SequencingRules = srs;
            se.RollupRules = rrs;
            se.Objectives = objs;
            se.RollupConsiderations = roCon;

            return se;
        }
        #endregion

        public static Objectives buildObjectiveForModuleForCustomTemplate(string objTarget)
        {
            Objectives objs = new Objectives();
            PrimaryObjective po = new PrimaryObjective();
            objs.PrimaryObjective = po;
            po.ObjectiveID = "PRIMARYOBJ";
            MapInfo mi = new MapInfo();
            mi.TargetObjectiveID = "obj_" + objTarget;
            mi.ReadNormalizedMeasure = "false";
            mi.ReadSatisfiedStatus = "false";
            mi.WriteSatisfiedStatus = "true";
            po.ListMapInfo = new List<MapInfo>();
            po.ListMapInfo.Add(mi);

            return objs;
        }
    }
}
